# Importing Data
AUSTRALIA <- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "C1:C239")

# Checking the Imported Data
View(AUSTRALIA)
# Creating Time Series Data
AUSTRALIA_ts <- ts(AUSTRALIA, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
AUSTRALIA_ts
sum(is.na(AUSTRALIA_ts))
library(forecast)
AUSTRALIA_ts <- tsclean(AUSTRALIA_ts)
AUSTRALIA_ts

# Identification: Plotting the Time Series Data
plot(AUSTRALIA_ts)

# Estimating the appropriate model
AUSTRALIA_ts_model <- auto.arima(AUSTRALIA_ts)
AUSTRALIA_ts_model

# Forecasting
options(max.print=1000000)
AUSTRALIA_ts_forecast <- forecast (AUSTRALIA_ts_model, level=c(95), h=255)
plot(AUSTRALIA_ts_forecast)
AUSTRALIA_ts_forecast             

# Exporting
write.table(AUSTRALIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/AUSTRALIA_TSA.csv", sep=",")
